<?php
namespace api\toilet\controller;

use api\admin\model\ToiletModel;
use api\toilet\logic\PushModel;
use cmf\controller\RestBaseController;

class PushController extends RestBaseController
{

    // /**
    //  * [pushWhSensor 推送垃圾中转站环境数据---武汉]
    //  * @return [type] [description]
    //  */
    // public function pushWhSensor()
    // {

    //     $config = config('post_band');
    //     $push   = new PushModel();
    //     //循环获取mac绑定的集成平台ID
    //     $result = [];
    //     foreach ($config as $key => $value)
    //     {
    //         $result[$key] = $push->pushWhData($key, $value);
    //     }

    //     return $result;
    // }

    /**
     * [PushWhSensor 接口推送]
     * @return [type] [description]
     */

    public function pushWhSensor()
    {
        
        $push   = new PushModel();

        //获取配置
        $config = config('post_band');

        //获取推送的公厕
        $data = (new ToiletModel())
            ->field('mac')
            ->where([
                'user_id' => 43,
                'status' => 1,
            ])->select()->toArray();

        //筛选未配置的数据
        $filterData = $push->getFilterData($config,$data);
        //获取待推送的mac标识
        $pushData = $push->getPushData($filterData);
        print_r($pushData);exit();


    }

}
